import java.util.LinkedList;
import java.util.Queue;

/**
 * 只用一个队列实现栈
 */
public class Solution9_2 {

    private Queue<Integer> q = new LinkedList<>();
    private int top;

    public void push(int node){
        q.add(node);
        int size = q.size();
        while (size-- > 1){
            q.add(q.remove());
        }
    }

    public int pop(){
        return q.remove();
    }
}
